<?php


namespace App\Models\Pay;



use Yansongda\Pay\Pay;

class WxNotify extends Notify
{
    public static function verify()
    {
        $wechat = Pay::wechat(config('pay.wechat'));
        $data = $wechat->verify();
        if ($data->all()['result_code'] == 'SUCCESS') {
            $trade_no = $data->all()['out_trade_no'];
            self::notifyOrder($trade_no);
            return $wechat->success();
        }
        /*
         * array (
              'appid' => 'wxd7b375a532d59b90',
              'bank_type' => 'CMB_CREDIT',
              'cash_fee' => '1',
              'fee_type' => 'CNY',
              'is_subscribe' => 'N',
              'mch_id' => '1544431281',
              'nonce_str' => 'Jj5h4olLktqzXeqA',
              'openid' => 'opfQN5PZtDYTOgcLecAyjUimU3I4',
              'out_trade_no' => '20190726162103490741',
              'result_code' => 'SUCCESS',
              'return_code' => 'SUCCESS',
              'sign' => '080F4C16A9077DBE01EA7DCE64B3DBD6',
              'time_end' => '20190726162110',
              'total_fee' => '1',
              'trade_type' => 'JSAPI',
              'transaction_id' => '4200000349201907266734787850',
            )
         * */
    }
}